package cn.iocoder.yudao.module.product.spu.vo;

import cn.iocoder.yudao.framework.validation.InEnumValue;
import cn.iocoder.yudao.module.api.dine.enums.DineAttributeEnum;
import cn.iocoder.yudao.module.api.product.sku.dto.AdminPriceRespDTO;
import cn.iocoder.yudao.module.api.product.spu.enums.ProductPriceModeEnum;
import cn.iocoder.yudao.module.api.product.spu.enums.ProductSpuRecommendEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Schema(description = "管理后台 - 产品 SPU 精简 Response VO")
@Data
public class ProductSpuSimpleRespVO extends AdminPriceRespDTO {

    @Schema(description = "店铺编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111")
    private Long shopId;

    @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖")
    private String name;

    @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
    private Integer stock;

    @Schema(description = "产品状态：-1-回收站、0-已下架、1-已上架、2-待审核", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Integer status;

    @Schema(description = "单位名称")
    private String unitName;

    @Schema(description = "推荐类型：0-无、1-精选、2-爆款、3-新品、4-补贴", example = "0")
    @InEnumValue(ProductSpuRecommendEnum.class)
    private Integer recommend;

    @Schema(description = "是否积分产品", example = "false")
    private Boolean isIntegral;

    @Schema(description = "销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "200")
    private Integer salesCount;

    @Schema(description = "虚拟销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20000")
    private Integer virtualSalesCount;

    @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
    private Integer browseCount;

    @Schema(description = "标签，英文逗号分隔")
    private List<String> labels;

    @Schema(description = "菜肴属性：0-无、1-主食、2-荤菜、3-素菜、4-汤、5-调料、6-饮品、7-水果、20-锅底、50-套餐、98-餐盒、99-备注")
    @InEnumValue(DineAttributeEnum.class)
    private Integer dishAttribute;
    @Schema(description = "菜肴属性：0-无、1-主食、2-荤菜、3-素菜、4-汤、5-调料、6-饮品、7-水果、20-锅底、50-套餐、98-餐盒、99-备注")
    private String dishAttributeName;

    @SuppressWarnings("unused")
    public String getDishAttributeName() {
        if (dishAttributeName == null) {
            return DineAttributeEnum.getByValue(getDishAttribute()).getName();
        }
        return dishAttributeName;
    }

    @Schema(description = "计价模式：1-按单品计价、2-按称量计价")
    @InEnumValue(ProductPriceModeEnum.class)
    private Integer priceMode;

}
